﻿namespace WPF.TestEditor.Controls
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Controls;
    using WPF.TestEditor.Common.Interfaces;
    using global::EasyStep.Business.Interfaces;
    using System.Windows;
    using System.Windows.Input;

    public class UserControlBase:UserControl
    {

        private ITestContextWindow _ParenWindow;
        public ITestContextWindow ParenWindow
        {
            get
            {
                if (_ParenWindow != null) return _ParenWindow;
                var w = Window.GetWindow(this);
                if (w == null) w = App.Current.MainWindow;
                if (w != null) _ParenWindow = (ITestContextWindow)w;

                return _ParenWindow;
            }
        }
        public ITestDataContext TestDataContext
        {
            get
            {
                if (ParenWindow == null) return null;
                return ParenWindow.TestDataContext;
            }
        }

    

        public UserControlBase()
        {           
        }
    }
}
